package com.module.compose.base.utils

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import com.module.compose.base.BaseActivity

/**
 * zhangjunfei  2020/11/13 10:45
 */

/**
 * 使用class进行跳转
 */

fun <T : BaseActivity> Activity.goTo(clazz: Class<T>, bundle: Bundle? = null) {
    val intent = Intent(this, clazz)
    bundle?.let {
        intent.putExtras(it)
    }
    startActivity(intent)
}

/**
 * 可实现不同module之间的跳转
 */
fun Activity.goTo(clazzName: String, bundle: Bundle? = null) {

    val intent = Intent(this, Class.forName(clazzName))
    bundle?.let {
        intent.putExtras(it)
    }
    startActivity(intent)
}